﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using CRC.NHibernate;

namespace CRC.Controladores
{
    class ControladorListarCongregaciones
    {
        private static String strQryAnfitrionas = "select c.Salon.Id, c.NombreCRC from Congregacion c where c.EsAnfitriona=true order by c.NombreCRC";
        
        public IList<Object[]> listarAnfitrionas()
        {
            ISession session = null;
            IList<Object[]> salones = null;

            try
            {
                session = NHibernateHelper.GetCurrentSession();

                salones = (IList<Object[]>)session.CreateQuery(strQryAnfitrionas).List<Object[]>();
                return salones;
            }
            catch (HibernateException he)
            {
                if (session != null) session.Close();
                throw he;
            }
        }
    }
}
